package com.situ.mall.admin.controller;


import com.situ.mall.admin.service.IUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller
@RequestMapping("/")
public class LoginController {

    @Autowired
    private IUserService userService;

    @GetMapping("/login")
    public String page(){
        return "login";
    }


    @PostMapping("/login")
    public String login(String username,String password){
        boolean b = userService.check(username,password);
        if(b){
            return "redirect:/";
        }else  {
            return "login";
        }
    }

}
